#!/bin/sh

#  This script is trying to change the variable name based on the value 
#+ of other variable
#  First of all, we can not change the variable name in the running time
#  But we can generate a function name in the running time and use the 
#+ function to give the result of the variable value;

KERNEL_LIST_RHEL4="This is kernel list of RHEL4"
KERNEL_LIST_SLES9="This is kernel list of SLES9"


kernel_list_RHEL4()
{
    echo $KERNEL_LIST_RHEL4
}

kernel_list_SLES9()
{
    echo $KERNEL_LIST_SLES9
}



DISTS="RHEL4 SLES9"

for dist in $DISTS
do
    kernel_list_func=$(echo kernel_list_$dist)
    kernel_list=$($kernel_list_func)
    echo "output: " $kernel_list
done 


dist=$(echo KERNEL_LIST_RHEL4)
eval kernel_list=\$$dist

echo "kernel_list=$kernel_list"
